//
//  HDWalletDetailViewController.swift
//  HuaDaoPeifu
//
//  Created by ZERO on 2018/6/5.
//  Copyright © 2018年 paiyipai. All rights reserved.
//

import UIKit

class HDWalletDetailViewController: UIViewController , UITableViewDelegate, UITableViewDataSource{
    
    @IBOutlet weak var topView: UIView!
    @IBOutlet weak var pfrzBtn: UIButton!
    
    @IBOutlet weak var txjlBtn: UIButton!
    
    @IBOutlet weak var tableView: UITableView!
    
    var inList : [HDWalletModel] = []
    var outList : [HDWalletModel] = []
    var type: NSInteger = 0
    
    override func viewDidLoad() {
        super.viewDidLoad()

        title = "钱包明细"

        setUI()


        // Do any additional setup after loading the view.
    }

    func setUI() {
        topView.layer.borderWidth = 1
        topView.layer.cornerRadius = 3
        topView.layer.borderColor = UIColor(hex: 0xdbdbdb).cgColor
        
        tableView.register(UINib(nibName: "HDWalletDetailCell", bundle: nil), forCellReuseIdentifier: "HDWalletDetailCell")
        
    }
    
    
    @IBAction func selectAction(_ sender: UIButton) {
        if sender == pfrzBtn {
            type = 0
            
            pfrzBtn.setTitleColor(UIColor.white,for:
                UIControlState())
            pfrzBtn.backgroundColor = UIColor(red:(255/255.0), green:(138/255.0), blue:(0/255.0), alpha:1.0)

            txjlBtn.setTitleColor(UIColor.black,for:
                UIControlState())
            txjlBtn.backgroundColor = UIColor.white
        } else{
            type = 1
            
            txjlBtn.setTitleColor(UIColor.white,for:
                UIControlState())
            txjlBtn.backgroundColor = UIColor(red:(255/255.0), green:(138/255.0), blue:(0/255.0), alpha:1.0)

            pfrzBtn.setTitleColor(UIColor.black,for:
                UIControlState())
            pfrzBtn.backgroundColor = UIColor.white

        }
        
        self.tableView!.reloadData()

    }
    
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
      
        if type == 0{
            return 2
            //                return inList.count
        }
        //                return outList.count
        return 3
    }
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCell(withIdentifier: "HDWalletDetailCell", for: indexPath) as! HDWalletDetailCell
        //        cell.walletModel = OnList[indexPath.row]
        return cell
    }
    func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {

        let heighttt = 70
        return CGFloat(heighttt)
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}


